#!/usr/bin/env bash
#
#  vim:ts=4:sts=4:sw=4:et
#
#  Author: Hari Sekhon
#  Date: 2018-10-07 13:57:07 +0100 (Sun, 07 Oct 2018)
#
#  https://github.com/HariSekhon/Dockerfiles
#
#  License: see accompanying Hari Sekhon LICENSE file
#
#  If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish
#
#  https://www.linkedin.com/in/HariSekhon
#

# Get list of versions to be used by tests/check_for_new_version

set -euo pipefail
[ -n "${DEBUG:-}" ] && set -x

get_versions(){
    curl -sS https://releases.hashicorp.com/consul/ |
    egrep -i -o 'href="/consul/[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+(-[[:alnum:]]+)?' |
    grep -v -e '-beta' -e '-rc' |
    sed 's,href="/consul/,,'
}

get_versions
